﻿// ReSharper disable ArrangeObjectCreationWhenTypeEvident
// ReSharper disable BuiltInTypeReferenceStyle
// ReSharper disable ConvertToAutoProperty
// ReSharper disable InconsistentNaming
// ReSharper disable PartialTypeWithSinglePart
// ReSharper disable PreferConcreteValueOverDefault
// ReSharper disable RedundantNameQualifier
// ReSharper disable SuggestVarOrType_SimpleTypes
// ReSharper disable UnusedMember.Global
// ReSharper disable UnusedMethodReturnValue.Local
// ReSharper disable UnusedType.Global

// EntityIdOrDataClient

// <auto-generated/>
#nullable enable annotations
#nullable disable warnings

namespace Microsoft.Extensions.DependencyInjection
{
    // StrawberryShake.CodeGeneration.CSharp.Generators.DependencyInjectionGenerator
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
    public static partial class EntityIdOrDataClientServiceCollectionExtensions
    {
        public static global::StrawberryShake.IClientBuilder<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.EntityIdOrDataClientStoreAccessor> AddEntityIdOrDataClient(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::StrawberryShake.ExecutionStrategy strategy = global::StrawberryShake.ExecutionStrategy.NetworkOnly)
        {
            var serviceCollection = new global::Microsoft.Extensions.DependencyInjection.ServiceCollection();
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp =>
            {
                ConfigureClientDefault(sp, serviceCollection, strategy);
                return new ClientServiceProvider(global::Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(serviceCollection));
            });
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => new global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.EntityIdOrDataClientStoreAccessor(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.IOperationStore>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<ClientServiceProvider>(sp)), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.IEntityStore>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<ClientServiceProvider>(sp)), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.IEntityIdSerializer>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<ClientServiceProvider>(sp)), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::System.Collections.Generic.IEnumerable<global::StrawberryShake.IOperationRequestFactory>>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<ClientServiceProvider>(sp)), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::System.Collections.Generic.IEnumerable<global::StrawberryShake.IOperationResultDataFactory>>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<ClientServiceProvider>(sp))));
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.GetFooQuery>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<ClientServiceProvider>(sp)));
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFooQuery>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<ClientServiceProvider>(sp)));
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.EntityIdOrDataClient>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<ClientServiceProvider>(sp)));
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IEntityIdOrDataClient>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<ClientServiceProvider>(sp)));
            return new global::StrawberryShake.ClientBuilder<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.EntityIdOrDataClientStoreAccessor>("EntityIdOrDataClient", services, serviceCollection);
        }

        private static global::Microsoft.Extensions.DependencyInjection.IServiceCollection ConfigureClientDefault(global::System.IServiceProvider parentServices, global::Microsoft.Extensions.DependencyInjection.ServiceCollection services, global::StrawberryShake.ExecutionStrategy strategy = global::StrawberryShake.ExecutionStrategy.NetworkOnly)
        {
            global::Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAddSingleton<global::StrawberryShake.IEntityStore, global::StrawberryShake.EntityStore>(services);
            global::Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAddSingleton<global::StrawberryShake.IOperationStore>(services, sp => new global::StrawberryShake.OperationStore(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.IEntityStore>(sp)));
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Transport.InMemory.IInMemoryConnection>(services, sp =>
            {
                var clientFactory = global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.Transport.InMemory.IInMemoryClientFactory>(parentServices);
                return new global::StrawberryShake.Transport.InMemory.InMemoryConnection(async ct => await clientFactory.CreateAsync("EntityIdOrDataClient", ct));
            });
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IEntityMapper<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.BazEntity, global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.GetFoo_Foo_Baz>, global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.GetFoo_Foo_BazFromBazEntityMapper>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IEntityMapper<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.Baz2Entity, global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.GetFoo_Foo_Baz2>, global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.GetFoo_Foo_Baz2FromBaz2EntityMapper>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.StringSerializer>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.BooleanSerializer>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.ByteSerializer>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.ShortSerializer>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.IntSerializer>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.LongSerializer>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.FloatSerializer>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.DecimalSerializer>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.UrlSerializer>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.UUIDSerializer>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.IdSerializer>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.DateTimeSerializer>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.DateSerializer>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.LocalDateSerializer>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.LocalDateTimeSerializer>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.LocalTimeSerializer>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.ByteArraySerializer>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.TimeSpanSerializer>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.JsonSerializer>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializerResolver>(services, sp => new global::StrawberryShake.Serialization.SerializerResolver(global::System.Linq.Enumerable.Concat(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::System.Collections.Generic.IEnumerable<global::StrawberryShake.Serialization.ISerializer>>(parentServices), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::System.Collections.Generic.IEnumerable<global::StrawberryShake.Serialization.ISerializer>>(sp))));
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IOperationResultDataFactory<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFooResult>, global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.GetFooResultFactory>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IOperationResultDataFactory>(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.IOperationResultDataFactory<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFooResult>>(sp));
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IOperationRequestFactory>(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFooQuery>(sp));
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IOperationResultBuilder<global::System.Text.Json.JsonDocument, global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFooResult>, global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.GetFooBuilder>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IOperationExecutor<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFooResult>>(services, sp => new global::StrawberryShake.OperationExecutor<global::System.Text.Json.JsonDocument, global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFooResult>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.Transport.InMemory.IInMemoryConnection>(sp), () => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.IOperationResultBuilder<global::System.Text.Json.JsonDocument, global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFooResult>>(sp), () => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.IResultPatcher<global::System.Text.Json.JsonDocument>>(sp), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.IOperationStore>(sp), strategy));
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IResultPatcher<global::System.Text.Json.JsonDocument>, global::StrawberryShake.Json.JsonResultPatcher>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.GetFooQuery>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFooQuery>(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.GetFooQuery>(sp));
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IEntityIdSerializer, global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.EntityIdOrDataClientEntityIdFactory>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.EntityIdOrDataClient>(services);
            global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IEntityIdOrDataClient>(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.EntityIdOrDataClient>(sp));
            return services;
        }

        private sealed class ClientServiceProvider : System.IServiceProvider, System.IDisposable
        {
            private readonly System.IServiceProvider _provider;
            public ClientServiceProvider(System.IServiceProvider provider)
            {
                _provider = provider;
            }

            public object? GetService(System.Type serviceType)
            {
                return _provider.GetService(serviceType);
            }

            public void Dispose()
            {
                if (_provider is System.IDisposable d)
                {
                    d.Dispose();
                }
            }
        }
    }
}

namespace StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData
{
    // StrawberryShake.CodeGeneration.CSharp.Generators.ResultTypeGenerator
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
    public partial class GetFooResult : global::System.IEquatable<GetFooResult>, IGetFooResult
    {
        public GetFooResult(global::System.Collections.Generic.IReadOnlyList<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFoo_Foo?>? foo)
        {
            Foo = foo;
        }

        public global::System.Collections.Generic.IReadOnlyList<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFoo_Foo?>? Foo { get; }

        public virtual global::System.Boolean Equals(GetFooResult? other)
        {
            if (ReferenceEquals(null, other))
            {
                return false;
            }

            if (ReferenceEquals(this, other))
            {
                return true;
            }

            if (other.GetType() != GetType())
            {
                return false;
            }

            return (global::StrawberryShake.Internal.ComparisonHelper.SequenceEqual(Foo, other.Foo));
        }

        public override global::System.Boolean Equals(global::System.Object? obj)
        {
            if (ReferenceEquals(null, obj))
            {
                return false;
            }

            if (ReferenceEquals(this, obj))
            {
                return true;
            }

            if (obj.GetType() != GetType())
            {
                return false;
            }

            return Equals((GetFooResult)obj);
        }

        public override global::System.Int32 GetHashCode()
        {
            unchecked
            {
                int hash = 5;
                if (Foo != null)
                {
                    foreach (var Foo_elm in Foo)
                    {
                        if (Foo_elm != null)
                        {
                            hash ^= 397 * Foo_elm.GetHashCode();
                        }
                    }
                }

                return hash;
            }
        }
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.ResultTypeGenerator
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
    public partial class GetFoo_Foo_Baz : global::System.IEquatable<GetFoo_Foo_Baz>, IGetFoo_Foo_Baz
    {
        public GetFoo_Foo_Baz(global::System.String? id)
        {
            Id = id;
        }

        public global::System.String? Id { get; }

        public virtual global::System.Boolean Equals(GetFoo_Foo_Baz? other)
        {
            if (ReferenceEquals(null, other))
            {
                return false;
            }

            if (ReferenceEquals(this, other))
            {
                return true;
            }

            if (other.GetType() != GetType())
            {
                return false;
            }

            return (((Id is null && other.Id is null) || Id != null && Id.Equals(other.Id)));
        }

        public override global::System.Boolean Equals(global::System.Object? obj)
        {
            if (ReferenceEquals(null, obj))
            {
                return false;
            }

            if (ReferenceEquals(this, obj))
            {
                return true;
            }

            if (obj.GetType() != GetType())
            {
                return false;
            }

            return Equals((GetFoo_Foo_Baz)obj);
        }

        public override global::System.Int32 GetHashCode()
        {
            unchecked
            {
                int hash = 5;
                if (Id != null)
                {
                    hash ^= 397 * Id.GetHashCode();
                }

                return hash;
            }
        }
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.ResultTypeGenerator
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
    public partial class GetFoo_Foo_Quox : global::System.IEquatable<GetFoo_Foo_Quox>, IGetFoo_Foo_Quox
    {
        public GetFoo_Foo_Quox(global::System.String? foo)
        {
            Foo = foo;
        }

        public global::System.String? Foo { get; }

        public virtual global::System.Boolean Equals(GetFoo_Foo_Quox? other)
        {
            if (ReferenceEquals(null, other))
            {
                return false;
            }

            if (ReferenceEquals(this, other))
            {
                return true;
            }

            if (other.GetType() != GetType())
            {
                return false;
            }

            return (((Foo is null && other.Foo is null) || Foo != null && Foo.Equals(other.Foo)));
        }

        public override global::System.Boolean Equals(global::System.Object? obj)
        {
            if (ReferenceEquals(null, obj))
            {
                return false;
            }

            if (ReferenceEquals(this, obj))
            {
                return true;
            }

            if (obj.GetType() != GetType())
            {
                return false;
            }

            return Equals((GetFoo_Foo_Quox)obj);
        }

        public override global::System.Int32 GetHashCode()
        {
            unchecked
            {
                int hash = 5;
                if (Foo != null)
                {
                    hash ^= 397 * Foo.GetHashCode();
                }

                return hash;
            }
        }
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.ResultTypeGenerator
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
    public partial class GetFoo_Foo_Baz2 : global::System.IEquatable<GetFoo_Foo_Baz2>, IGetFoo_Foo_Baz2
    {
        public GetFoo_Foo_Baz2(global::System.String? id)
        {
            Id = id;
        }

        public global::System.String? Id { get; }

        public virtual global::System.Boolean Equals(GetFoo_Foo_Baz2? other)
        {
            if (ReferenceEquals(null, other))
            {
                return false;
            }

            if (ReferenceEquals(this, other))
            {
                return true;
            }

            if (other.GetType() != GetType())
            {
                return false;
            }

            return (((Id is null && other.Id is null) || Id != null && Id.Equals(other.Id)));
        }

        public override global::System.Boolean Equals(global::System.Object? obj)
        {
            if (ReferenceEquals(null, obj))
            {
                return false;
            }

            if (ReferenceEquals(this, obj))
            {
                return true;
            }

            if (obj.GetType() != GetType())
            {
                return false;
            }

            return Equals((GetFoo_Foo_Baz2)obj);
        }

        public override global::System.Int32 GetHashCode()
        {
            unchecked
            {
                int hash = 5;
                if (Id != null)
                {
                    hash ^= 397 * Id.GetHashCode();
                }

                return hash;
            }
        }
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.ResultTypeGenerator
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
    public partial class GetFoo_Foo_Quox2 : global::System.IEquatable<GetFoo_Foo_Quox2>, IGetFoo_Foo_Quox2
    {
        public GetFoo_Foo_Quox2(global::System.String? foo)
        {
            Foo = foo;
        }

        public global::System.String? Foo { get; }

        public virtual global::System.Boolean Equals(GetFoo_Foo_Quox2? other)
        {
            if (ReferenceEquals(null, other))
            {
                return false;
            }

            if (ReferenceEquals(this, other))
            {
                return true;
            }

            if (other.GetType() != GetType())
            {
                return false;
            }

            return (((Foo is null && other.Foo is null) || Foo != null && Foo.Equals(other.Foo)));
        }

        public override global::System.Boolean Equals(global::System.Object? obj)
        {
            if (ReferenceEquals(null, obj))
            {
                return false;
            }

            if (ReferenceEquals(this, obj))
            {
                return true;
            }

            if (obj.GetType() != GetType())
            {
                return false;
            }

            return Equals((GetFoo_Foo_Quox2)obj);
        }

        public override global::System.Int32 GetHashCode()
        {
            unchecked
            {
                int hash = 5;
                if (Foo != null)
                {
                    hash ^= 397 * Foo.GetHashCode();
                }

                return hash;
            }
        }
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.ResultInterfaceGenerator
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
    public partial interface IGetFooResult
    {
        public global::System.Collections.Generic.IReadOnlyList<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFoo_Foo?>? Foo { get; }
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.ResultInterfaceGenerator
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
    public partial interface IGetFoo_Foo
    {
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.ResultInterfaceGenerator
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
    public partial interface IGetFoo_Foo_Baz : IGetFoo_Foo
    {
        public global::System.String? Id { get; }
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.ResultInterfaceGenerator
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
    public partial interface IGetFoo_Foo_Quox : IGetFoo_Foo
    {
        public global::System.String? Foo { get; }
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.ResultInterfaceGenerator
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
    public partial interface IGetFoo_Foo_Baz2 : IGetFoo_Foo
    {
        public global::System.String? Id { get; }
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.ResultInterfaceGenerator
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
    public partial interface IGetFoo_Foo_Quox2 : IGetFoo_Foo
    {
        public global::System.String? Foo { get; }
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.OperationDocumentGenerator
    /// <summary>
    /// Represents the operation service of the GetFoo GraphQL operation
    /// <code>
    /// query GetFoo {
    ///   foo {
    ///     __typename
    ///     ... on Baz {
    ///       id
    ///     }
    ///     ... on Quox {
    ///       foo
    ///     }
    ///     ... on Baz2 {
    ///       id
    ///     }
    ///     ... on Quox2 {
    ///       foo
    ///     }
    ///     ... on Baz {
    ///       id
    ///     }
    ///     ... on Baz2 {
    ///       id
    ///     }
    ///   }
    /// }
    /// </code>
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
    public partial class GetFooQueryDocument : global::StrawberryShake.IDocument
    {
        private GetFooQueryDocument()
        {
        }

        public static GetFooQueryDocument Instance { get; } = new GetFooQueryDocument();
        public global::StrawberryShake.OperationKind Kind => global::StrawberryShake.OperationKind.Query;
        public global::System.ReadOnlySpan<global::System.Byte> Body => "query GetFoo { foo { __typename ... on Baz { id } ... on Quox { foo } ... on Baz2 { id } ... on Quox2 { foo } ... on Baz { id } ... on Baz2 { id } } }"u8;
        public global::StrawberryShake.DocumentHash Hash { get; } = new global::StrawberryShake.DocumentHash("sha1Hash", "43715bb5e8ecbe7659e99dcb33abcf1ffeadff8e");

        public override global::System.String ToString()
        {
#if NETCOREAPP3_1_OR_GREATER
        return global::System.Text.Encoding.UTF8.GetString(Body);
#else
            return global::System.Text.Encoding.UTF8.GetString(Body.ToArray());
#endif
        }
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.OperationServiceGenerator
    /// <summary>
    /// Represents the operation service of the GetFoo GraphQL operation
    /// <code>
    /// query GetFoo {
    ///   foo {
    ///     __typename
    ///     ... on Baz {
    ///       id
    ///     }
    ///     ... on Quox {
    ///       foo
    ///     }
    ///     ... on Baz2 {
    ///       id
    ///     }
    ///     ... on Quox2 {
    ///       foo
    ///     }
    ///     ... on Baz {
    ///       id
    ///     }
    ///     ... on Baz2 {
    ///       id
    ///     }
    ///   }
    /// }
    /// </code>
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
    public partial class GetFooQuery : global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFooQuery
    {
        private readonly global::StrawberryShake.IOperationExecutor<IGetFooResult> _operationExecutor;
        private readonly global::System.Collections.Immutable.ImmutableArray<global::System.Action<global::StrawberryShake.OperationRequest>> _configure = global::System.Collections.Immutable.ImmutableArray<global::System.Action<global::StrawberryShake.OperationRequest>>.Empty;
        public GetFooQuery(global::StrawberryShake.IOperationExecutor<IGetFooResult> operationExecutor)
        {
            _operationExecutor = operationExecutor ?? throw new global::System.ArgumentNullException(nameof(operationExecutor));
        }

        private GetFooQuery(global::StrawberryShake.IOperationExecutor<IGetFooResult> operationExecutor, global::System.Collections.Immutable.ImmutableArray<global::System.Action<global::StrawberryShake.OperationRequest>> configure)
        {
            _operationExecutor = operationExecutor;
            _configure = configure;
        }

        global::System.Type global::StrawberryShake.IOperationRequestFactory.ResultType => typeof(IGetFooResult);

        public global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFooQuery With(global::System.Action<global::StrawberryShake.OperationRequest> configure)
        {
            return new global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.GetFooQuery(_operationExecutor, _configure.Add(configure));
        }

        public global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFooQuery WithRequestUri(global::System.Uri requestUri)
        {
            return With(r => r.ContextData["StrawberryShake.Transport.Http.HttpConnection.RequestUri"] = requestUri);
        }

        public global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFooQuery WithHttpClient(global::System.Net.Http.HttpClient httpClient)
        {
            return With(r => r.ContextData["StrawberryShake.Transport.Http.HttpConnection.HttpClient"] = httpClient);
        }

        public async global::System.Threading.Tasks.Task<global::StrawberryShake.IOperationResult<IGetFooResult>> ExecuteAsync(global::System.Threading.CancellationToken cancellationToken = default)
        {
            var request = CreateRequest();
            foreach (var configure in _configure)
            {
                configure(request);
            }

            return await _operationExecutor.ExecuteAsync(request, cancellationToken).ConfigureAwait(false);
        }

        public global::System.IObservable<global::StrawberryShake.IOperationResult<IGetFooResult>> Watch(global::StrawberryShake.ExecutionStrategy? strategy = null)
        {
            var request = CreateRequest();
            return _operationExecutor.Watch(request, strategy);
        }

        private global::StrawberryShake.OperationRequest CreateRequest()
        {
            return CreateRequest(null);
        }

        private global::StrawberryShake.OperationRequest CreateRequest(global::System.Collections.Generic.IReadOnlyDictionary<global::System.String, global::System.Object?>? variables)
        {
            return new global::StrawberryShake.OperationRequest(id: GetFooQueryDocument.Instance.Hash.Value, name: "GetFoo", document: GetFooQueryDocument.Instance, strategy: global::StrawberryShake.RequestStrategy.Default);
        }

        global::StrawberryShake.OperationRequest global::StrawberryShake.IOperationRequestFactory.Create(global::System.Collections.Generic.IReadOnlyDictionary<global::System.String, global::System.Object?>? variables)
        {
            return CreateRequest();
        }
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.OperationServiceInterfaceGenerator
    /// <summary>
    /// Represents the operation service of the GetFoo GraphQL operation
    /// <code>
    /// query GetFoo {
    ///   foo {
    ///     __typename
    ///     ... on Baz {
    ///       id
    ///     }
    ///     ... on Quox {
    ///       foo
    ///     }
    ///     ... on Baz2 {
    ///       id
    ///     }
    ///     ... on Quox2 {
    ///       foo
    ///     }
    ///     ... on Baz {
    ///       id
    ///     }
    ///     ... on Baz2 {
    ///       id
    ///     }
    ///   }
    /// }
    /// </code>
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
    public partial interface IGetFooQuery : global::StrawberryShake.IOperationRequestFactory
    {
        global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFooQuery With(global::System.Action<global::StrawberryShake.OperationRequest> configure);
        global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFooQuery WithRequestUri(global::System.Uri requestUri);
        global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFooQuery WithHttpClient(global::System.Net.Http.HttpClient httpClient);
        global::System.Threading.Tasks.Task<global::StrawberryShake.IOperationResult<IGetFooResult>> ExecuteAsync(global::System.Threading.CancellationToken cancellationToken = default);
        global::System.IObservable<global::StrawberryShake.IOperationResult<IGetFooResult>> Watch(global::StrawberryShake.ExecutionStrategy? strategy = null);
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.ClientGenerator
    /// <summary>
    /// Represents the EntityIdOrDataClient GraphQL client
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
    public partial class EntityIdOrDataClient : global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IEntityIdOrDataClient
    {
        private readonly global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFooQuery _getFoo;
        public EntityIdOrDataClient(global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFooQuery getFoo)
        {
            _getFoo = getFoo ?? throw new global::System.ArgumentNullException(nameof(getFoo));
        }

        public static global::System.String ClientName => "EntityIdOrDataClient";
        public global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFooQuery GetFoo => _getFoo;
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.ClientInterfaceGenerator
    /// <summary>
    /// Represents the EntityIdOrDataClient GraphQL client
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
    public partial interface IEntityIdOrDataClient
    {
        global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFooQuery GetFoo { get; }
    }
}

namespace StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State
{
    // StrawberryShake.CodeGeneration.CSharp.Generators.EntityTypeGenerator
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "0.0.0.0")]
    public partial class BazEntity
    {
        public BazEntity(global::System.String? id = default !)
        {
            Id = id;
        }

        public global::System.String? Id { get; }
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.EntityTypeGenerator
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "0.0.0.0")]
    public partial class Baz2Entity
    {
        public Baz2Entity(global::System.String? id = default !)
        {
            Id = id;
        }

        public global::System.String? Id { get; }
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.ResultDataFactoryGenerator
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
    public partial class GetFooResultFactory : global::StrawberryShake.IOperationResultDataFactory<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.GetFooResult>
    {
        private readonly global::StrawberryShake.IEntityStore _entityStore;
        private readonly global::StrawberryShake.IEntityMapper<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.BazEntity, GetFoo_Foo_Baz> _getFoo_Foo_BazFromBazEntityMapper;
        private readonly global::StrawberryShake.IEntityMapper<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.Baz2Entity, GetFoo_Foo_Baz2> _getFoo_Foo_Baz2FromBaz2EntityMapper;
        public GetFooResultFactory(global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityMapper<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.BazEntity, GetFoo_Foo_Baz> getFoo_Foo_BazFromBazEntityMapper, global::StrawberryShake.IEntityMapper<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.Baz2Entity, GetFoo_Foo_Baz2> getFoo_Foo_Baz2FromBaz2EntityMapper)
        {
            _entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
            _getFoo_Foo_BazFromBazEntityMapper = getFoo_Foo_BazFromBazEntityMapper ?? throw new global::System.ArgumentNullException(nameof(getFoo_Foo_BazFromBazEntityMapper));
            _getFoo_Foo_Baz2FromBaz2EntityMapper = getFoo_Foo_Baz2FromBaz2EntityMapper ?? throw new global::System.ArgumentNullException(nameof(getFoo_Foo_Baz2FromBaz2EntityMapper));
        }

        global::System.Type global::StrawberryShake.IOperationResultDataFactory.ResultType => typeof(global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFooResult);

        public GetFooResult Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot = null)
        {
            if (snapshot is null)
            {
                snapshot = _entityStore.CurrentSnapshot;
            }

            if (dataInfo is GetFooResultInfo info)
            {
                return new GetFooResult(MapIGetFoo_FooArray(info.Foo, snapshot));
            }

            throw new global::System.ArgumentException("GetFooResultInfo expected.");
        }

        private global::System.Collections.Generic.IReadOnlyList<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFoo_Foo?>? MapIGetFoo_FooArray(global::System.Collections.Generic.IReadOnlyList<global::StrawberryShake.EntityIdOrData?>? list, global::StrawberryShake.IEntityStoreSnapshot snapshot)
        {
            if (list is null)
            {
                return null;
            }

            var bars = new global::System.Collections.Generic.List<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFoo_Foo?>();
            foreach (global::StrawberryShake.EntityIdOrData? child in list)
            {
                bars.Add(MapIGetFoo_Foo(child, snapshot));
            }

            return bars;
        }

        private global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFoo_Foo? MapIGetFoo_Foo(global::StrawberryShake.EntityIdOrData? data, global::StrawberryShake.IEntityStoreSnapshot snapshot)
        {
            if (data is null)
            {
                return null;
            }

            if (data.Value.EntityId is { } id)
            {
                return MapIGetFoo_FooData(id, snapshot);
            }
            else if (data.Value.Data is global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.IBarData d)
            {
                return MapIGetFoo_FooEntity(d, snapshot);
            }
            else
            {
                throw new global::System.ArgumentOutOfRangeException();
            }
        }

        private global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFoo_Foo? MapIGetFoo_FooEntity(global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.IBarData? data, global::StrawberryShake.IEntityStoreSnapshot snapshot)
        {
            if (data is null)
            {
                return null;
            }

            IGetFoo_Foo? returnValue;
            if (data is global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.QuoxData quox)
            {
                returnValue = new global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.GetFoo_Foo_Quox(quox.Foo);
            }
            else if (data is global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.Quox2Data quox2)
            {
                returnValue = new global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.GetFoo_Foo_Quox2(quox2.Foo);
            }
            else
            {
                throw new global::System.NotSupportedException();
            }

            return returnValue;
        }

        private global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFoo_Foo? MapIGetFoo_FooData(global::StrawberryShake.EntityId? entityId, global::StrawberryShake.IEntityStoreSnapshot snapshot)
        {
            if (entityId is null)
            {
                return null;
            }

            if (entityId.Value.Name.Equals("Baz", global::System.StringComparison.Ordinal))
            {
                return _getFoo_Foo_BazFromBazEntityMapper.Map(snapshot.GetEntity<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.BazEntity>(entityId.Value) ?? throw new global::StrawberryShake.GraphQLClientException());
            }

            if (entityId.Value.Name.Equals("Baz2", global::System.StringComparison.Ordinal))
            {
                return _getFoo_Foo_Baz2FromBaz2EntityMapper.Map(snapshot.GetEntity<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.Baz2Entity>(entityId.Value) ?? throw new global::StrawberryShake.GraphQLClientException());
            }

            throw new global::System.NotSupportedException();
        }

        global::System.Object global::StrawberryShake.IOperationResultDataFactory.Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot)
        {
            return Create(dataInfo, snapshot);
        }
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.ResultInfoGenerator
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
    public partial class GetFooResultInfo : global::StrawberryShake.IOperationResultDataInfo
    {
        private readonly global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> _entityIds;
        private readonly global::System.UInt64 _version;
        public GetFooResultInfo(global::System.Collections.Generic.IReadOnlyList<global::StrawberryShake.EntityIdOrData?>? foo, global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> entityIds, global::System.UInt64 version)
        {
            Foo = foo;
            _entityIds = entityIds ?? throw new global::System.ArgumentNullException(nameof(entityIds));
            _version = version;
        }

        public global::System.Collections.Generic.IReadOnlyList<global::StrawberryShake.EntityIdOrData?>? Foo { get; }
        public global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> EntityIds => _entityIds;
        public global::System.UInt64 Version => _version;

        public global::StrawberryShake.IOperationResultDataInfo WithVersion(global::System.UInt64 version)
        {
            return new GetFooResultInfo(Foo, _entityIds, version);
        }
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.JsonResultBuilderGenerator
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
    public partial class GetFooBuilder : global::StrawberryShake.OperationResultBuilder<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFooResult>
    {
        private readonly global::StrawberryShake.IEntityStore _entityStore;
        private readonly global::StrawberryShake.IEntityIdSerializer _idSerializer;
        private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::System.String> _stringParser;
        public GetFooBuilder(global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityIdSerializer idSerializer, global::StrawberryShake.IOperationResultDataFactory<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFooResult> resultDataFactory, global::StrawberryShake.Serialization.ISerializerResolver serializerResolver)
        {
            _entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
            _idSerializer = idSerializer ?? throw new global::System.ArgumentNullException(nameof(idSerializer));
            ResultDataFactory = resultDataFactory ?? throw new global::System.ArgumentNullException(nameof(resultDataFactory));
            _stringParser = serializerResolver.GetLeafValueParser<global::System.String, global::System.String>("String") ?? throw new global::System.ArgumentException("No serializer for type `String` found.");
        }

        protected override global::StrawberryShake.IOperationResultDataFactory<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.IGetFooResult> ResultDataFactory { get; }

        protected override global::StrawberryShake.IOperationResultDataInfo BuildData(global::System.Text.Json.JsonElement obj)
        {
            var entityIds = new global::System.Collections.Generic.HashSet<global::StrawberryShake.EntityId>();
            global::StrawberryShake.IEntityStoreSnapshot snapshot = default !;
            global::System.Collections.Generic.IReadOnlyList<global::StrawberryShake.EntityIdOrData?>? fooId = default !;
            _entityStore.Update(session =>
            {
                fooId = Deserialize_IBarDataArray(session, global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "foo"), entityIds);
                snapshot = session.CurrentSnapshot;
            });
            return new GetFooResultInfo(fooId, entityIds, snapshot.Version);
        }

        private global::System.Collections.Generic.IReadOnlyList<global::StrawberryShake.EntityIdOrData?>? Deserialize_IBarDataArray(global::StrawberryShake.IEntityStoreUpdateSession session, global::System.Text.Json.JsonElement? obj, global::System.Collections.Generic.ISet<global::StrawberryShake.EntityId> entityIds)
        {
            if (!obj.HasValue)
            {
                return null;
            }

            if (obj.Value.ValueKind == global::System.Text.Json.JsonValueKind.Null)
            {
                return null;
            }

            var bars = new global::System.Collections.Generic.List<global::StrawberryShake.EntityIdOrData?>();
            foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray())
            {
                bars.Add(Deserialize_IBarData(session, child, entityIds));
            }

            return bars;
        }

        private global::StrawberryShake.EntityIdOrData? Deserialize_IBarData(global::StrawberryShake.IEntityStoreUpdateSession session, global::System.Text.Json.JsonElement? obj, global::System.Collections.Generic.ISet<global::StrawberryShake.EntityId> entityIds)
        {
            if (!obj.HasValue)
            {
                return null;
            }

            if (obj.Value.ValueKind == global::System.Text.Json.JsonValueKind.Null)
            {
                return null;
            }

            var typename = obj.Value.GetProperty("__typename").GetString();
            if (typename?.Equals("Baz", global::System.StringComparison.Ordinal) ?? false)
            {
                global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value);
                if (entityId.Name.Equals("Baz", global::System.StringComparison.Ordinal))
                {
                    if (session.CurrentSnapshot.TryGetEntity(entityId, out global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.BazEntity? entity))
                    {
                        session.SetEntity(entityId, new global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.BazEntity(Deserialize_String(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "id"))));
                    }
                    else
                    {
                        session.SetEntity(entityId, new global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.BazEntity(Deserialize_String(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "id"))));
                    }

                    return new global::StrawberryShake.EntityIdOrData(entityId);
                }
            }

            if (typename?.Equals("Quox", global::System.StringComparison.Ordinal) ?? false)
            {
                return new global::StrawberryShake.EntityIdOrData(new global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.QuoxData(typename, foo: Deserialize_String(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "foo"))));
            }

            if (typename?.Equals("Baz2", global::System.StringComparison.Ordinal) ?? false)
            {
                global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value);
                if (entityId.Name.Equals("Baz2", global::System.StringComparison.Ordinal))
                {
                    if (session.CurrentSnapshot.TryGetEntity(entityId, out global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.Baz2Entity? entity))
                    {
                        session.SetEntity(entityId, new global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.Baz2Entity(Deserialize_String(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "id"))));
                    }
                    else
                    {
                        session.SetEntity(entityId, new global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.Baz2Entity(Deserialize_String(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "id"))));
                    }

                    return new global::StrawberryShake.EntityIdOrData(entityId);
                }
            }

            if (typename?.Equals("Quox2", global::System.StringComparison.Ordinal) ?? false)
            {
                return new global::StrawberryShake.EntityIdOrData(new global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.Quox2Data(typename, foo: Deserialize_String(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "foo"))));
            }

            throw new global::System.NotSupportedException();
        }

        private global::System.String? Deserialize_String(global::System.Text.Json.JsonElement? obj)
        {
            if (!obj.HasValue)
            {
                return null;
            }

            if (obj.Value.ValueKind == global::System.Text.Json.JsonValueKind.Null)
            {
                return null;
            }

            return _stringParser.Parse(obj.Value.GetString()!);
        }
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.DataTypeGenerator
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "0.0.0.0")]
    public partial interface IBarData
    {
        global::System.String __typename { get; }
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.DataTypeGenerator
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "0.0.0.0")]
    public partial class QuoxData : IBarData
    {
        public QuoxData(global::System.String __typename, global::System.String? foo = default !)
        {
            this.__typename = __typename ?? throw new global::System.ArgumentNullException(nameof(__typename));
            Foo = foo;
        }

        public global::System.String __typename { get; }
        public global::System.String? Foo { get; }
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.DataTypeGenerator
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "0.0.0.0")]
    public partial class Quox2Data : IBarData
    {
        public Quox2Data(global::System.String __typename, global::System.String? foo = default !)
        {
            this.__typename = __typename ?? throw new global::System.ArgumentNullException(nameof(__typename));
            Foo = foo;
        }

        public global::System.String __typename { get; }
        public global::System.String? Foo { get; }
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.ResultFromEntityTypeMapperGenerator
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
    public partial class GetFoo_Foo_BazFromBazEntityMapper : global::StrawberryShake.IEntityMapper<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.BazEntity, GetFoo_Foo_Baz>
    {
        private readonly global::StrawberryShake.IEntityStore _entityStore;
        public GetFoo_Foo_BazFromBazEntityMapper(global::StrawberryShake.IEntityStore entityStore)
        {
            _entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
        }

        public GetFoo_Foo_Baz Map(global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.BazEntity entity, global::StrawberryShake.IEntityStoreSnapshot? snapshot = null)
        {
            if (snapshot is null)
            {
                snapshot = _entityStore.CurrentSnapshot;
            }

            return new GetFoo_Foo_Baz(entity.Id);
        }
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.ResultFromEntityTypeMapperGenerator
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
    public partial class GetFoo_Foo_Baz2FromBaz2EntityMapper : global::StrawberryShake.IEntityMapper<global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.Baz2Entity, GetFoo_Foo_Baz2>
    {
        private readonly global::StrawberryShake.IEntityStore _entityStore;
        public GetFoo_Foo_Baz2FromBaz2EntityMapper(global::StrawberryShake.IEntityStore entityStore)
        {
            _entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
        }

        public GetFoo_Foo_Baz2 Map(global::StrawberryShake.CodeGeneration.CSharp.Integration.EntityIdOrData.State.Baz2Entity entity, global::StrawberryShake.IEntityStoreSnapshot? snapshot = null)
        {
            if (snapshot is null)
            {
                snapshot = _entityStore.CurrentSnapshot;
            }

            return new GetFoo_Foo_Baz2(entity.Id);
        }
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.EntityIdFactoryGenerator
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
    public partial class EntityIdOrDataClientEntityIdFactory : global::StrawberryShake.IEntityIdSerializer
    {
        private static readonly global::System.Text.Json.JsonWriterOptions _options = new global::System.Text.Json.JsonWriterOptions()
        {
            Indented = false
        };
        public global::StrawberryShake.EntityId Parse(global::System.Text.Json.JsonElement obj)
        {
            global::System.String __typename = obj.GetProperty("__typename").GetString()!;
            return __typename switch
            {
                "Baz" => ParseBazEntityId(obj, __typename),
                "Baz2" => ParseBaz2EntityId(obj, __typename),
                _ => throw new global::System.NotSupportedException()};
        }

        public global::System.String Format(global::StrawberryShake.EntityId entityId)
        {
            return entityId.Name switch
            {
                "Baz" => FormatBazEntityId(entityId),
                "Baz2" => FormatBaz2EntityId(entityId),
                _ => throw new global::System.NotSupportedException()};
        }

        private global::StrawberryShake.EntityId ParseBazEntityId(global::System.Text.Json.JsonElement obj, global::System.String type)
        {
            return new global::StrawberryShake.EntityId(type, obj.GetProperty("id").GetString()!);
        }

        private global::System.String FormatBazEntityId(global::StrawberryShake.EntityId entityId)
        {
            using var writer = new global::StrawberryShake.Internal.ArrayWriter();
            using var jsonWriter = new global::System.Text.Json.Utf8JsonWriter(writer, _options);
            jsonWriter.WriteStartObject();
            jsonWriter.WriteString("__typename", entityId.Name);
            jsonWriter.WriteString("id", (global::System.String)entityId.Value);
            jsonWriter.WriteEndObject();
            jsonWriter.Flush();
            return global::System.Text.Encoding.UTF8.GetString(writer.GetInternalBuffer(), 0, writer.Length);
        }

        private global::StrawberryShake.EntityId ParseBaz2EntityId(global::System.Text.Json.JsonElement obj, global::System.String type)
        {
            return new global::StrawberryShake.EntityId(type, obj.GetProperty("id").GetString()!);
        }

        private global::System.String FormatBaz2EntityId(global::StrawberryShake.EntityId entityId)
        {
            using var writer = new global::StrawberryShake.Internal.ArrayWriter();
            using var jsonWriter = new global::System.Text.Json.Utf8JsonWriter(writer, _options);
            jsonWriter.WriteStartObject();
            jsonWriter.WriteString("__typename", entityId.Name);
            jsonWriter.WriteString("id", (global::System.String)entityId.Value);
            jsonWriter.WriteEndObject();
            jsonWriter.Flush();
            return global::System.Text.Encoding.UTF8.GetString(writer.GetInternalBuffer(), 0, writer.Length);
        }
    }

    // StrawberryShake.CodeGeneration.CSharp.Generators.StoreAccessorGenerator
    [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
    public partial class EntityIdOrDataClientStoreAccessor : global::StrawberryShake.StoreAccessor
    {
        public EntityIdOrDataClientStoreAccessor(global::StrawberryShake.IOperationStore operationStore, global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityIdSerializer entityIdSerializer, global::System.Collections.Generic.IEnumerable<global::StrawberryShake.IOperationRequestFactory> requestFactories, global::System.Collections.Generic.IEnumerable<global::StrawberryShake.IOperationResultDataFactory> resultDataFactories) : base(operationStore, entityStore, entityIdSerializer, requestFactories, resultDataFactories)
        {
        }
    }
}


